package com.msmall.community.bbs.action.html;

import com.msmall.base.exception.AuthorityException;
import com.msmall.base.exception.DataNotFoundException;
import com.msmall.community.bbs.model.Topic;
import com.msmall.community.bbs.service.ThreadManager;
import com.msmall.community.bbs.service.TopicManager;

public class MasterAction extends BBSBaseAction{

	private static final long serialVersionUID = -3185077863696555678L;

	private Long toBid; //移动帖子时，移动到的版区ID
	
	private TopicManager topicManager;
	
	private ThreadManager threadManager;
	
	public String deleteTopic() throws AuthorityException{
		
		topicManager.delete(tid, getUserid());
		
		return SUCCESS;
	}
	
	public String deleteThread() throws AuthorityException, DataNotFoundException{
		threadManager.delete(hid, getUserid());
		return SUCCESS;
	}
	
	/**
	 * 置顶
	 * @return
	 * @throws DataNotFoundException
	 * @throws AuthorityException
	 */
	public String setTop() throws DataNotFoundException, AuthorityException{
		topicManager.setTop(tid, getUserid());
		return SUCCESS;
	}
	/**
	 * 解除置顶
	 * @return
	 * @throws AuthorityException 
	 * @throws DataNotFoundException 
	 */
	public String deleteTop() throws DataNotFoundException, AuthorityException{
		topicManager.deleteTop(tid, getUserid());
		return SUCCESS;
	}
	/**
	 * 进入移动帖子页面
	 * @return
	 */
	public String toMove(){
		topic = (Topic) topicManager.get(Topic.class, tid);
		return SUCCESS;
	}
	/**
	 * 移动帖子
	 * @return
	 */
	public String move(){
		return SUCCESS;
	}
	public String setElite() throws DataNotFoundException, AuthorityException{
		topicManager.setElite(tid, getUserid());
		return SUCCESS;
	}
	/**
	 * 解除精华
	 * @return
	 * @throws AuthorityException 
	 * @throws DataNotFoundException 
	 */
	public String deleteElite() throws DataNotFoundException, AuthorityException{
		topicManager.deleteElite(tid, getUserid());
		return SUCCESS;
	}

	public Long getToBid() {
		return toBid;
	}

	public void setToBid(Long toBid) {
		this.toBid = toBid;
	}

	public TopicManager getTopicManager() {
		return topicManager;
	}

	public void setTopicManager(TopicManager topicManager) {
		this.topicManager = topicManager;
	}

	public ThreadManager getThreadManager() {
		return threadManager;
	}

	public void setThreadManager(ThreadManager threadManager) {
		this.threadManager = threadManager;
	}
}
